package com.imooc.api.controller.user;

import com.imooc.api.config.MyServiceList;
import com.imooc.api.fallbacks.UserControllerApiFallBack;
import com.imooc.grance.result.GraceJsonResult;
import com.imooc.pojo.bo.UpdateUserInfoBO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * Created with IntelliJ IDEA.
 *
 * @auther Levi
 * @Date: 2021/03/14/22:13
 * @Description:
 */
@Api(value = "UserControllerApi", tags = "用户相关功能的controller")
@RequestMapping("/user")
@FeignClient(value = MyServiceList.SERVICE_USER,fallbackFactory = UserControllerApiFallBack.class)//被调用方开启feign支持，并且指明服务名称

public interface UserControllerApi {
    /**
     * 获得用户基本信息
     *
     * @param userId
     * @return
     */
    @ApiOperation(value = "获得用户基本信息", notes = "获得用户基本信息", httpMethod = "POST")
    @PostMapping("/getUserInfo")
    public GraceJsonResult getUserInfo(@RequestParam String userId);

    /**
     * 获得用户账号信息
     *
     * @param userId
     * @return
     */
    @ApiOperation(value = "获得用户账号信息", notes = "获得用户账号信息", httpMethod = "POST")
    @PostMapping("/getAccountInfo")
    public GraceJsonResult getCountInfo(@RequestParam String userId);

    /**
     * 完善用户信息
     *
     * @param updateUserInfoBO
     * @return
     */
    @ApiOperation(value = "完善用户信息", notes = "完善用户信息", httpMethod = "POST")
    @PostMapping("/updateUserInfo")
    public GraceJsonResult updateUserInfo(@Valid @RequestBody UpdateUserInfoBO updateUserInfoBO);

    @ApiOperation(value = "根据用户的ids查询用户列表", notes = "根据用户的ids查询用户列表", httpMethod = "GET")
    @GetMapping("/queryByIds")
    public GraceJsonResult queryByIds(@RequestParam String userIds);

}




